package com.ruoyi.business.controller;

import javax.servlet.http.HttpServletResponse;

import com.ruoyi.business.domain.TDSsq;
import com.ruoyi.business.service.ITDSsqService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.page.TableDataInfo;

import java.util.List;

/**
 * 双色球历史投注Controller
 * 
 * @author ruoyi
 * @date 2022-02-25
 */
@RestController
@RequestMapping("/business/ssq")
public class TDSsqController extends BaseController
{
    @Autowired
    private ITDSsqService tDSsqService;

    /**
     * 查询双色球历史投注列表
     */
    @PreAuthorize("@ss.hasPermi('business:ssq:list')")
    @GetMapping("/list")
    public TableDataInfo list(TDSsq tDSsq)
    {
        startPage();
        List<TDSsq> list = tDSsqService.selectTDSsqList(tDSsq);
        return getDataTable(list);
    }

    /**
     * 导出双色球历史投注列表
     */
    @PreAuthorize("@ss.hasPermi('business:ssq:export')")
    @Log(title = "双色球历史投注", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TDSsq tDSsq)
    {
        List<TDSsq> list = tDSsqService.selectTDSsqList(tDSsq);
        ExcelUtil<TDSsq> util = new ExcelUtil<TDSsq>(TDSsq.class);
        util.exportExcel(response, list, "双色球历史投注数据");
    }

    /**
     * 获取双色球历史投注详细信息
     */
    @PreAuthorize("@ss.hasPermi('business:ssq:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return AjaxResult.success(tDSsqService.selectTDSsqById(id));
    }

    /**
     * 新增双色球历史投注
     */
    @PreAuthorize("@ss.hasPermi('business:ssq:add')")
    @Log(title = "双色球历史投注", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TDSsq tDSsq)
    {
        return toAjax(tDSsqService.insertTDSsq(tDSsq));
    }

    /**
     * 修改双色球历史投注
     */
    @PreAuthorize("@ss.hasPermi('business:ssq:edit')")
    @Log(title = "双色球历史投注", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TDSsq tDSsq)
    {
        return toAjax(tDSsqService.updateTDSsq(tDSsq));
    }

    /**
     * 删除双色球历史投注
     */
    @PreAuthorize("@ss.hasPermi('business:ssq:remove')")
    @Log(title = "双色球历史投注", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(tDSsqService.deleteTDSsqByIds(ids));
    }
}
